<?php

namespace App\Http\Controllers\Api\czy;

use App\Common\Paginate;

use App\Common\ValidatorCheck;
use App\Http\Controllers\Controller;
use App\Models\Love;
use App\Models\VrSellHouse;
use App\Common\Responses;
use Illuminate\Http\Request;
class LoveController extends Controller
{
    /*
     * 获取vr房源
     * @czy
     * */
    public function getIndex(Request $request){
        try {

            $params['page'] = (int)$request->get('page',1);
            $params['limit'] = (int)$request->get('limit',4);
            $params['uid'] = (string)$request->get('uid')?:null;
            $params['fang_id'] = (float)$request->get('fang_id')?:null;

            list($limit,$offset) = Paginate::paginate($params['page'],$params['limit']);
            $data = Love::getSecharvr($params,$limit,$offset);

            return Responses::success($data,20000);
        }catch (\Exception $exception){
            return Responses::error([],2001,$exception->getMessage());
        }
    }
    /*
       * 获取vr房源详情
       * @czy
       * */
    public function getVrSellHouseDetail(Request $request)
    {
        try {
            $params['id'] = (int)$request->get('id')?:null;
            ValidatorCheck::paramsCheck($params,[
                'id' =>'required|integer',
            ]);
            $data =   Love::detail([['is_del','=',0],['id','=',$params['id']]]);
            return Responses::success($data,20000);
        }catch (\Exception $exception){
            return Responses::error([$exception->getMessage()],$exception->getCode());
        }

    }



}
